/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/


// 分页数据
export interface BaseApiPage<T = any> {
  dataList: T,
  itemSize: string | number
  pageCount: string | number
  pageNo: string | number
  pagesize: string | number
}
// 基础服务api
export interface BaseApiResponse<T = any> {
  statusCode?: string | number;
  statusMessage?: string;
  data: T extends Array<any> ? BaseApiPage<T> : T
}
export type SocPublish = {
  mCode: string;
  sCode: string;
  socVersion: string;
  permissions: any;
};
export type ChangeList = {
  mCode: string;
  sCode: string;
  socVersion?: string;
  edition?: string;
};
export type CartypeResultItem = {
  unpublishTotal: number;
  detail: any;
  sCode: string;
  label: string;
  seriesName: string;
  value: string;
  unpublishCount: number;
  models: any;
};
type permission = {
  skillVersionId: string,
  role: any[]
}
export type abilityPushlist = {
  mCode: string,
  sCode: string,
  socVersion: string,
  permissions: permission[]
}
export type importExcelParams = {
  carModel: string;
  socVersion: string;
  file: any;
};

export type SoaListResultItem = {
  serviceVersionId: string;
  serviceId: string;
  serviceName: string;
  description: string;
  namespace: string;
  majorVersion: string;
  minorVersion: string;
  socVersion: string;
  carModel: string;
  status: string;
  methods: any;
  fileId: string;
  isNew: boolean;
};

export type PublishDelParams = {
  mCode: string;
  sCode: string;
  socVersion: string;
};
export type SoaListResult = SoaListResultItem[];

export type SocListResult = {
  carModel: string;
  socVersion: any;
}[];

export type SoaListParams = {
  pageNumber?: number;
  pageSize?: number;
  carModel?: string;
  serviceName?: string;
  socVersion?: string;
  [props: string]: any;
};

export type SoaDetailParams = {
  serviceVersionId: string;
};

export type SoaDetailBasic = {
  serviceName: string;
  serviceId: number;
  description: string;
  namespace: string;
  majorVersion: string;
  minorVersion: string;
  socVersion: string;
  carModel: string;
  status: string;
  sCode: string;
  mCode: string;
};

export type SoaDetailResult = {
  methods?: SoaDetailResultMethod[];
} & SoaDetailBasic;

export interface SoaDetailResultMethod {
  role: any;
  methodName: string;
  methodId: number;
  description: string;
  status: string;
  methodType: string;
  eventGroupId: string;
  eventGroupName: string;
  l4Protocol: string;
  useType: string;
  majorVersion: string;
  minorVersion: string;
  uri: string;
  params: SoaDetailResultMethodParams[];
}

export interface SoaDetailResultMethodParams {
  name: string;
  description: string;
  direction: string;
  referType: string;
  defValue: string;
  required: boolean;
  paramId: number;
}

export enum Methods {
  POST = 'POST',
  GET = 'GET',
  DELETE = 'DELETE',
  PUT = 'PUT',
}


export interface AdminUser {
  id: number;
  uuid: string;
  mobile: string;
  email: string;
  isActive: number;
  lockTime: string;
  createTime: string;
  profile: {
    name: string;
    avatar: string;
    gender: number;
    nickname: string;
    address: string;
    birthday: string;
  };
}
export type ApprovalParams = {
  approval: ApprovalParamsItem[]
};
export type ApprovalParamsItem = {
  applyId: string,
  status: number,
  reason: string
};
export type userPermissionItem = {
  nickname: string,
  type: number,
  uuid: string,
  mobile: string,
  email: string,
};
export type userPermissionListParams = {
  pageNumber: number,
  pageSize: number,
  status: string,
  mCode: string,
  sCode: string,
}
export type docPermissionListParams = {
  pageNumber: number,
  pageSize: number,
  mCode: string,
  sCode: string,
}
export type republishParams = {
  mCode: string,
  sCode: string,
  permissions: any,
  fileIds: string
}
export type getUserPermissionDetailParams = {
  pageNumber: number,
  pageSize: number,
  status: string,
  mCode: string,
  sCode: string,
  userId: string
}
export interface userPermissionDetailItemMethods {
  methodId: string,
  methodName: string,
  methodDesc: string,
  status: number,
  applyId: string,
  reason: string
}
export interface userPermissionDetailItem {
  serviceId: string,
  serviceName: string,
  serviceDesc: string,
  methods: userPermissionDetailItemMethods[],
}